package org.example;

import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgnitionEx;
import org.junit.Test;
import org.my.stock.h2.TypeToStockH2;
import org.my.stock.util.TypeToStock;

import java.beans.PropertyVetoException;
import java.sql.SQLException;

public class TypeToStockCase {
    @Test
    public void test_type_date() throws IgniteCheckedException {
        TypeToStock.updateAll();
    }

    @Test
    public void test_type_date_h2() throws SQLException, ClassNotFoundException, PropertyVetoException {
        TypeToStockH2.updateAll();
    }

    @Test
    public void test_type_date1() throws IgniteCheckedException {
        String springCfgPath = "/Users/chenfei/Documents/Java/my_database/my-stock/src/main/resources/default-config.xml";
        Ignite ignite = IgnitionEx.start(springCfgPath);
        CacheConfiguration<?, ?> cacheCfg = new CacheConfiguration<>("public_meta");
        cacheCfg.setSqlSchema("PUBLIC");

        IgniteCache<?, ?> cache = ignite.getOrCreateCache(cacheCfg);
        TypeToStock.getData(cache, "BK1112", "破净股", 1);
    }
}
